home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / shadez.swf / scripts / Local / Game / Thing / CSpriteFrame.as < prev    next >
Encoding:
Text File  |  2011-08-19  |  7.2 KB  |  266 lines

  1.  
  2. {
  3.    if(true)
  4.    {
  5.       CSpriteFrame = ┬º┬ºnewclass(CSpriteFrame,Object);
  6.    }
  7. }
  8.  
  9. package Local.Game.Thing
  10. {
  11.    import Local.Game.World.*;
  12.    import flash.display.*;
  13.    import flash.events.*;
  14.    import flash.filters.*;
  15.    import flash.geom.*;
  16.    
  17.    public class CSpriteFrame
  18.    {
  19.       
  20.       public static const zPoint:Point;
  21.       
  22.       public static const mMatrixScalar:Matrix;
  23.       
  24.       public static var mFlipX:Boolean = false;
  25.       
  26.       {
  27.          if(true)
  28.          {
  29.             zPoint = new Point(0,0);
  30.             if(true)
  31.             {
  32.                mMatrixScalar = CThingSprite.mMatrixScalar;
  33.             }
  34.             mFlipX = false;
  35.          }
  36.       }
  37.       
  38.       public var mCanDispose:Boolean = false;
  39.       
  40.       private var mcContainer:MovieClip;
  41.       
  42.       public var mBMD:BitmapData;
  43.       
  44.       public var mDispMatrix:Matrix;
  45.       
  46.       public var mArea:Rectangle;
  47.       
  48.       public var mDisplacement:Point;
  49.       
  50.       public var mObjects:Object;
  51.       
  52.       public var mFrameIndex:int;
  53.       
  54.       private var mcGraphic:MovieClip;
  55.       
  56.       public function CSpriteFrame()
  57.       {
  58.          if(true)
  59.          {
  60.             mCanDispose = false;
  61.             if(true)
  62.             {
  63.                super();
  64.             }
  65.             mObjects = new Object();
  66.          }
  67.       }
  68.       
  69.       public static function asMovieClip(param1:MovieClip) : CSpriteFrame
  70.       {
  71.          var _loc2_:CSpriteFrame = null;
  72.          _loc2_ = new CSpriteFrame();
  73.          if(true)
  74.          {
  75.             _loc2_.mcContainer = new MovieClip();
  76.             var _loc3_:*;
  77.             _loc2_.mcGraphic = _loc3_ = param1;
  78.             _loc2_.mcContainer.addChild(_loc3_);
  79.          }
  80.          return _loc2_;
  81.       }
  82.       
  83.       public static function asFrame(param1:Object) : CSpriteFrame
  84.       {
  85.          var _loc2_:CSpriteFrame = null;
  86.          _loc2_ = new CSpriteFrame();
  87.          _loc2_.mBMD = param1.bmd;
  88.          _loc2_.mDisplacement = param1.disp;
  89.          _loc2_.Finalize();
  90.          return _loc2_;
  91.       }
  92.       
  93.       private function _compileObjects(param1:MovieClip, param2:Matrix, param3:String = "") : void
  94.       {
  95.          var _loc4_:int = 0;
  96.          var _loc5_:* = undefined;
  97.          var _loc6_:* = null;
  98.          var _loc7_:Point = null;
  99.          var _loc8_:Matrix = null;
  100.          if(true)
  101.          {
  102.             _loc4_ = param1.numChildren - 1;
  103.          }
  104.          for(; _loc4_ >= 0; _loc4_--)
  105.          {
  106.             if((_loc5_ = param1.getChildAt(_loc4_)) == null)
  107.             {
  108.                continue;
  109.             }
  110.             ┬º┬ºpush(_loc5_.name.indexOf("instance") == 0);
  111.             if(true)
  112.             {
  113.                ┬º┬ºpush(┬º┬ºpop() || _loc5_.name == "");
  114.             }
  115.             if(┬º┬ºpop())
  116.             {
  117.                continue;
  118.             }
  119.             ┬º┬ºpush(String(_loc5_.name));
  120.             if(true)
  121.             {
  122.                ┬º┬ºpush(_loc6_ = ┬º┬ºpop());
  123.                if(true)
  124.                {
  125.                   if(┬º┬ºpop().indexOf("vis_") == 0)
  126.                   {
  127.                      addr82:
  128.                      _loc6_ = String(_loc6_.substring(4));
  129.                      _loc5_.visible = true;
  130.                      addr79:
  131.                   }
  132.                   else
  133.                   {
  134.                      _loc5_.visible = false;
  135.                   }
  136.                   (_loc7_ = param2.deltaTransformPoint(new Point(1,0))).normalize(1);
  137.                   if(true)
  138.                   {
  139.                      mObjects[param3 + _loc6_] = {
  140.                         "mPosition":param2.transformPoint(new Point(_loc5_.x,_loc5_.y)),
  141.                         "mDelta":_loc7_
  142.                      };
  143.                   }
  144.                   (_loc8_ = _loc5_.transform.matrix).concat(param2);
  145.                   if(true)
  146.                   {
  147.                      _compileObjects(_loc5_,_loc8_,_loc6_ + "_");
  148.                   }
  149.                   continue;
  150.                }
  151.                ┬º┬ºgoto(addr79);
  152.             }
  153.             ┬º┬ºgoto(addr82);
  154.          }
  155.       }
  156.       
  157.       public function get mMemSize() : uint
  158.       {
  159.          return mBMD.width * mBMD.height * 4;
  160.       }
  161.       
  162.       public function ApplyWhiten() : void
  163.       {
  164.          if(true)
  165.          {
  166.             mcGraphic.transform.colorTransform = new ColorTransform(1,1,1,1,255,255,255,255);
  167.          }
  168.       }
  169.       
  170.       public function ApplyGreen() : void
  171.       {
  172.          mcGraphic.transform.colorTransform = new ColorTransform(0,1,0,1,0,255,0,255);
  173.       }
  174.       
  175.       public function ApplyBlue() : void
  176.       {
  177.          if(true)
  178.          {
  179.             mcGraphic.transform.colorTransform = new ColorTransform(0,0,1,1,0,0,255,255);
  180.          }
  181.       }
  182.       
  183.       public function ApplyReden() : void
  184.       {
  185.          mcGraphic.transform.colorTransform = new ColorTransform(1,0,0,1,255,0,0,255);
  186.       }
  187.       
  188.       public function PostFilter(param1:*) : void
  189.       {
  190.          mBMD.applyFilter(mBMD,mBMD.rect,zPoint,param1);
  191.       }
  192.       
  193.       public function CaptureMovieClip() : void
  194.       {
  195.          var _loc1_:Rectangle = null;
  196.          var _loc2_:Point = null;
  197.          var _loc3_:Object = null;
  198.          _loc1_ = mcContainer.getBounds(mcContainer);
  199.          _loc1_.inflate(2,2);
  200.          mBMD = new BitmapData(_loc1_.width,_loc1_.height,true,16711680);
  201.          mDisplacement = new Point(Math.floor(_loc1_.left),Math.floor(_loc1_.top));
  202.          _compileObjects(mcGraphic,mcGraphic.transform.matrix);
  203.          mBMD.draw(mcContainer,new Matrix(1,0,0,1,-mDisplacement.x,-mDisplacement.y));
  204.          if(mcGraphic["_origin"])
  205.          {
  206.             _loc2_ = mcGraphic.transform.matrix.transformPoint(new Point(mcGraphic["_origin"].x,mcGraphic["_origin"].y));
  207.             if(true)
  208.             {
  209.                mDisplacement.x -= _loc2_.x;
  210.                mDisplacement.y -= _loc2_.y;
  211.             }
  212.             for each(_loc3_ in mObjects)
  213.             {
  214.                _loc3_.mPosition = _loc3_.mPosition.subtract(_loc2_);
  215.             }
  216.          }
  217.          Finalize(mcGraphic.transform.matrix);
  218.       }
  219.       
  220.       public function ApplyFilter(param1:*) : void
  221.       {
  222.          if(true)
  223.          {
  224.             mcContainer.filters.push(param1);
  225.          }
  226.       }
  227.       
  228.       public function ApplyBlacken() : void
  229.       {
  230.          if(true)
  231.          {
  232.             mcGraphic.transform.colorTransform = new ColorTransform(0,0,0,1,0,0,0,255);
  233.          }
  234.       }
  235.       
  236.       public function ApplyScaleMatrix(param1:Matrix) : void
  237.       {
  238.          if(true)
  239.          {
  240.             mcGraphic.transform.matrix = param1;
  241.          }
  242.       }
  243.       
  244.       public function Finalize(param1:Matrix = null) : void
  245.       {
  246.          mDispMatrix = new Matrix(1,0,0,1,mDisplacement.x,mDisplacement.y);
  247.          mArea = new Rectangle(-mDisplacement.x,-mDisplacement.y,mBMD.width,mBMD.height);
  248.       }
  249.       
  250.       public function Dispose() : Boolean
  251.       {
  252.          ┬º┬ºpush(mCanDispose);
  253.          if(true)
  254.          {
  255.             if(┬º┬ºpop())
  256.             {
  257.                mBMD.dispose();
  258.                return true;
  259.             }
  260.             ┬º┬ºpush(false);
  261.          }
  262.          return ┬º┬ºpop();
  263.       }
  264.    }
  265. }
  266.